home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1994 December / PSL Monthly Shareware CD-ROM (Public Software Library)(December 1994).bin / prgmming / dos / pascal3 / prt.pas < prev    next >
Pascal/Delphi Source File  |  1989-12-08  |  10KB  |  303 lines

  1. Unit PRT;
  2. {    PRT.pas - Useful procs for IBM ProPrinter II XL24 & X24        }
  3. {    The following unit contains many useful printer routines       }
  4. {    for the IBM ProPrinter XL24. I have tested all procs and       }
  5. {    they seem to work great for me. Careful with some of them      }
  6. {    though, some routines seem to have funny effects depending     }
  7. {    on the order in which they are used. Keep an eye on any of     }
  8. {    the routines that vary line spacing, ( i.e. DHDW, LineNorm     }
  9. {    and LineSpace). In using these I have found it necessary       }
  10. {    thoroughly test and even make minor alterations in some        }
  11. {    cases for the unit to perform as planned.                      }
  12. {    This was written and checked w/ TurboPascal 5.5                }
  13. {    If YOU find any major flaws in this unit, please contact me    }
  14. {    to let me know.         Thanx!!!                               }
  15. {                           Rick Camp                               }
  16. {                   Compuserve ID# 72361,2755                       }
  17.  
  18. INTERFACE
  19.    uses Printer;
  20.  
  21.                { Used in Double High, Double Wide Procedure }
  22.  
  23. const          { This group contains valid values for "a"   }
  24.    LUCU = 0;   { no changes in either line feeds or char Ht.}
  25.    LUSH = 1;   { Linefeeds unchanged, single high character }
  26.    LUDH = 2;   { linefeeds unchanged, double high character }
  27.    SLCU = 16;  { single linefeeds, unchanged char. height   }
  28.    SLSH = 17;  { single linefeeds, single high character    }
  29.    SLDH = 18;  { single linefeeds, double high character    }
  30.    DLCU = 32;  { double linefeeds, unchanged char. height   }
  31.    DLSH = 33;  { double linefeeds, single high character    }
  32.    DLDH = 34;  { double linefeeds, double high character    }
  33.  
  34.                { This group contains valid values for "b"   }
  35.    SW = 1;     { single width characters }
  36.    DW = 2;     { double width characters }
  37.  
  38. Procedure Feed;
  39. Procedure Norm10;
  40. Procedure Norm12;
  41. Procedure Norm17;
  42. Procedure LQ10;
  43. Procedure LQ12;
  44. Procedure LQ17;
  45. Procedure DSOn;
  46. Procedure DSOff;
  47. Procedure EOn;
  48. Procedure EOff;
  49. Procedure PrBeep;
  50. Procedure PrBS;
  51. Procedure PrCR;
  52. Procedure DW_LineCancel;
  53. Procedure DW_LineStart;
  54. Procedure DWOn;
  55. Procedure DWOff;
  56. Procedure DHDW(a,b : byte);
  57. Procedure HT;
  58. Procedure PrLF;
  59. Procedure PrCondense;
  60. Procedure PrSpace;
  61. Procedure LineSpace(n: byte);
  62. Procedure LineNorm;
  63. Procedure FormLines(n : byte);
  64. Procedure FormInches(n :byte);
  65. Procedure SkipPerf(n: byte);
  66. Procedure SkipPerfOff;
  67. Procedure SubPrint;
  68. Procedure SuperPrint;
  69. Procedure CanSubNSuper;
  70. Procedure OverScOn;
  71. Procedure OverScOff;
  72. Procedure UnderScOn;
  73. Procedure UnderScOff;
  74. Procedure HorizMargins( L,R : byte);
  75. Procedure TopOfForm;
  76. procedure Pr;
  77.  
  78.  
  79. (*************************************************************************)
  80. IMPLEMENTATION
  81. Procedure Feed;
  82.    begin
  83.       write(lst,#12);        { formfeed - advances to next 'top of form' }
  84.    end;
  85.  
  86. Procedure Norm10;
  87.    begin
  88.       write(lst,#27#73#00);  { 10 cpi default print - draft mode }
  89.    end;
  90.  
  91. Procedure Norm12;
  92.    begin
  93.       write(lst,#155#73#08); { same as above but 12 cpi }
  94.    end;
  95.  
  96. Procedure Norm17;
  97.    begin
  98.       write(lst,#155#73#16); {   ditto...17 cpi }
  99.    end;
  100.  
  101. Procedure LQ10;
  102.    begin
  103.       write(lst,#155#73#2);  { letter quality 10 cpi }
  104.    end;
  105.  
  106. Procedure LQ12;
  107.    begin
  108.       write(lst,#155#73#10); { L.Q. 12 cpi }
  109.    end;
  110.  
  111. Procedure LQ17;
  112.    begin
  113.       write(lst,#155#73#18); { L.Q. 17 cpi }
  114.    end;
  115.  
  116. Procedure DSOn;
  117.    begin
  118.       write(lst,#155#71);    { double strike on }
  119.    end;
  120.  
  121. Procedure DSOff;
  122.    begin
  123.       write(lst,#155#72);    { DS off... what else? }
  124.    end;
  125.  
  126. Procedure EOn;
  127.    begin
  128.       write(lst,#155#69);    { turn on emphasized print }
  129.    end;
  130.  
  131. Procedure EOff;
  132.    begin
  133.       write(lst,#155#70);    { turn off emphasized print }
  134.    end;
  135.  
  136. Procedure PrBeep;
  137.    begin
  138.       write(lst,#7);         {   Make printer beep   }
  139.    end;
  140.  
  141. Procedure PrBS;              { backspace printhead - if @ posn 1, ignored.}
  142.    begin
  143.       write(lst,#8);         { use for creating overstrike chars. }
  144.    end;
  145.  
  146. Procedure PrCR;              { print head carriage return }
  147.    begin
  148.       write(lst,#13);
  149.    end;
  150.  
  151. Procedure DW_LineCancel;     { cancel double-wide setting }
  152.    begin
  153.       write(lst,#20);
  154.    end;
  155.  
  156. Procedure DW_LineStart;    { Start D-W setting. Cancelled with a cancel,   }
  157.    begin                   { carriage return, linefeed, vert.tab, formfeed,}
  158.       write(lst,#14);      { contin. DW on, or cancel DW line.             }
  159.    end;
  160.  
  161. Procedure DWOn;            { turns continuous double wide on.            }
  162.    begin
  163.       write(lst,#27#87#1);
  164.    end;
  165.  
  166. Procedure DWOff;           { turns continuous double wide off.            }
  167.    begin
  168.       write(lst,#27#87#0);
  169.    end;
  170.  
  171. Procedure DHDW(a, b : byte);
  172.    { Double Height - Double Width Proc.        }
  173.    { A, defined in the constants section, sets the style of linefeeds and }
  174.    { character height. B sets the character width. Use this same proc to  }
  175.    { turn DH or DW off using switches for a. After using, BE SURE to set  }
  176.    { line spacing back correctly. This is the only switch I've found that }
  177.    { will change single/double line spacing.( Other than the obvious power}
  178.    { switch or hardware reset.                                            }
  179.    begin
  180.       write(lst,#27#91#64#4#0#0#0,chr(a),chr(b));
  181.    end;
  182.  
  183. Procedure HT;             { advance print head to next horiz tab setting  }
  184.    begin                  { default is one every 8 spaces, starting at #9 }
  185.       write(lst,#9);
  186.    end;
  187.  
  188. Procedure PrLF;           { line feed for printer }
  189.    begin
  190.       write(lst,#10);
  191.    end;
  192.  
  193. Procedure PrCondense;     { prints @ 17 cpi - doesn't affect mode.    }
  194.    begin                  { if issued w/ printer in LQ,it stays in LQ }
  195.       write(lst,#15);
  196.    end;
  197.  
  198. Procedure PrSpace;        { advance print head one space horizontally}
  199.    begin
  200.       write(lst,#32);
  201.    end;
  202.  
  203. Procedure LineSpace(n: byte);  { sets spacing between line of text. N must  }
  204.    begin                       { be between 1 and 85. Increments of 1/72 in.}
  205.       if (n < 12) or (n > 85) then      { Default is 12, i.e 12/72 in.      }
  206.          n := 12;
  207.       write(lst,#27#65,chr(n));
  208.       write(lst,#27#50);
  209.    end;
  210.  
  211. Procedure LineNorm;           { resets line spacing to default @ 6 lines/in.}
  212.    begin
  213.       write(lst,#27#65#12);
  214.       write(lst,#27#50);
  215.    end;
  216.  
  217. Procedure FormLines(n : byte);     { Sets form length in # of lines. Also }
  218.    begin                           { sets top of form at current position }
  219.       write(lst,#27#67,chr(n));    { Will also override hardware switch in}
  220.    end;                            { printer case ( #4 on IBM Pro.XL24)   }
  221.  
  222. Procedure FormInches(n :byte);     { Sets form length in inches, increments }
  223.    begin                           { of 1/72 in. Same resets as listed above}
  224.       if n > 255 then              { 1 < N < 255.                           }
  225.          n := 255
  226.       else if n < 1 then
  227.          n := 1;
  228.       write(lst,#27#67#0,chr(n));
  229.    end;
  230.  
  231. Procedure SkipPerf(n: byte);       { n := # of lines the printer skips at }
  232.    begin                           { the end of each page, causing it to  }
  233.       if n > 255 then n := 255     { skip the perforations.  1 < N < 255  }
  234.       else if n < 1 then n := 1;   { Canceled by Formlines, FormInches and}
  235.       write(lst,#27#78,chr(n));    { SkipPerfOff.                         }
  236.    end;
  237.  
  238. Procedure SkipPerfOff;             { cancels perforation skipping         }
  239.    begin
  240.       write(lst,#27#79);
  241.    end;
  242.  
  243. Procedure SubPrint;                { Starts printing subscript.           }
  244.    begin
  245.       write(lst,#27#83#1);
  246.    end;
  247.  
  248. Procedure SuperPrint;              { Starts printing superscript.       }
  249.    begin
  250.       write(lst,#27#83#0);
  251.    end;
  252.  
  253. Procedure CanSubNSuper;            { Cancels either sub- or superscript,  }
  254.    begin                           { whichever is active. If neither, then}
  255.       write(lst,#27#84)